package com.akka;

import akka.actor.UntypedActor;

public class Greeter extends UntypedActor {

	public static enum Msg {
	    GREET, DONE;
	}
	
	@Override
	public void onReceive(Object msg) throws Exception {
		System.out.println("Greeter.onReceive() enter...");
		if (msg == Msg.GREET){
			
			System.out.println("Greeter.onReceive() receive Greet message to print HelloWorld!");
			
			System.out.println("Greeter.onReceive() Hello World!");
			
			System.out.println("Greeter.onReceive() tell Done message to sender.");
			getSender().tell(Msg.DONE, getSelf());
		} else {
			System.out.println("Greeter.onReceive() unhandled message.");
			unhandled(msg);
		}
		
		System.out.println("Greeter.onReceive() exit.");
	}

}
